cmake_minimum_required(VERSION 3.17)
project(Data_Processor)

set(CMAKE_CXX_STANDARD 14)

add_executable(${PROJECT_NAME} src/redis_io.cpp src/data_processor.cpp src/hardware_alert.cpp src/main.cpp)

# Self include
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)

# GPIO_Drivers
target_link_libraries(${PROJECT_NAME} libgpio-drivers.so)

# hiredis
find_path(HIREDIS_HEADER hiredis)
target_include_directories(${PROJECT_NAME} PUBLIC ${HIREDIS_HEADER})

find_library(HIREDIS_LIB hiredis)
target_link_libraries(${PROJECT_NAME} ${HIREDIS_LIB})

# redis-plus-plus
find_path(REDIS_PLUS_PLUS_HEADER sw)
target_include_directories(${PROJECT_NAME} PUBLIC ${REDIS_PLUS_PLUS_HEADER})

find_library(REDIS_PLUS_PLUS_LIB redis++)
target_link_libraries(${PROJECT_NAME} ${REDIS_PLUS_PLUS_LIB})

# json
find_package(nlohmann_json 3.9.0 REQUIRED)
target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json)

# Thread
FIND_PACKAGE(Threads)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})